<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>JSON 对象和字符串对象转换</title>
  <script type="text/javascript">
    window.onload=function () {
      var JsonPerson={
        "name":"jack",
        "age":20
      }
      console.log("jsonPerson=",JsonPerson)
      var strPerson = JSON.stringify(JsonPerson);
      console.log("jsonPerson=",strPerson)
      var strDog=" {\"name\":\"jack\",\"age\":2}";
      var JsonDog = JSON.parse(strDog);
      console.log("JsonDog=",JsonDog)

    }
  </script>
</head>
<body>
<h1>JSON 对象和字符串对象转换</h1>
</body>
</html>